Repository navigation
Reject ignored statements and run all of them in executemultiple - #364
Merged
Merged
Conversation
prepare/execute silently ran only the first statement of SQL like "CREATE TABLE t(a); INSERT INTO t VALUES (1)", and executemultiple returned only the first result. Now preparing SQL with more than one statement throws, and DBInterface.executemultiple runs each statement in order, preparing each after the previous one runs. Closes #303. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
quinnj
referenced
this pull request
Sep 30, 2026
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #303.
SQL with several statements silently ran only the first one:
sqlite3_prepare_v2reports where the first statement ends; we passedC_NULLfor that and dropped the rest.DBInterface.prepare,DBInterface.execute, andSQLite.executenow throwArgumentErrorif anything but whitespace or comments follows the first statement. Python'ssqlite3does the same. Trailing;, whitespace, and comments still work.DBInterface.executemultiple(db, sql, [params])runs every statement in order and returns their cursors. Each statement is prepared only after the previous one runs, soCREATE TABLE ...; INSERT INTO ...works. The sameparamsgo to every statement, so named parameters work across statements.Behavior change: code that passed several statements to
executeused to run only the first. It now errors, pointing toexecutemultiple. I think that's the right call, since the old behavior silently dropped writes, but it's worth a minor version bump.🤖 Generated with Claude Code